﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DeliveryService
{
    public class BLGoodsSmallCategorys
    {
        public List<MGoodsSmallCategorys> GetGoodsSmallCategorysByParentCategoryName(string parentCategoryName)
        {
            using(DeliveryDBDataContext db=new DeliveryDBDataContext())
            {
                var query = db.Goodscategory_s.Where(s => s.GoodsCategory.GoodsCategory_Name.Contains(parentCategoryName))
                    .Select(s => new MGoodsSmallCategorys
                    {
                        Id = s.GoodsCategory_S_ID,
                        SmallCategoryName = s.GoodsCategory_S_Name,
                        GoodsCategoryName = s.GoodsCategory.GoodsCategory_Name,
                    });
                return query.ToList();
            }
        }
    }
}